package com.xd.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xd.entity.Homework;
import com.xd.repository.HomeworkRepositroy;
import com.xd.service.HomeworkService;
import com.xd.vo.HomeworkVo;

@RestController
public class HomeworkController {
@Resource
 HomeworkService homeworkService;
	
//eureka欢迎界面信息
 @RequestMapping("/info")
 public String test1() {
	 return "welcome to xdservice";
 }
 
// 作业提交
 @RequestMapping("/add")
 public void handin(HomeworkVo homeworkVo) {
    homeworkService.add(homeworkVo);
 }
 
// 信息删除
 @RequestMapping("/del")
 public void del(Long id) {
	 homeworkService.del(id);
 }
 
// @RequestMapping("/upd")
// public void upd(HomeworkVo homeworkVo,Long id){
//	homeworkRepositroy.updateData(homeworkVo.getHomework(),homeworkVo.getName(),homeworkVo.getStuid(),id); 
// }
 
// 查看所有
 @RequestMapping("/findall")
 public List<Homework> findall() {
	 return homeworkService.findall();
 }
 
// 老师打分
 @RequestMapping("/giveScore")
 public void giveScore(Float score,Long id){
	 homeworkService.giveScore(score, id);
 }
}
